// 写首页页面发送的请求
import request from "../untils/request";

// 首页数据
export const indexData = () => {
	return request("/api/front/index")
}

// 首页优惠信息
export const indexDiscount = () => {
	return request("/api/front/coupons", {
		page: 1,
		limit: 6
	})
}

// 领取优惠券
export const receiveCoupon = (id) => {
	return request("/api/front/coupon/receive", {
		'couponId': id
	}, "POST")
}

// 首页商品信息
export const indexGoods = (type) => {
	const url = "/api/front/index/product/" + type + "?page=1&limit=10"
	return request(url)
}

// 首页下的搜索
// 搜索
export const searchKeyWords = (data) => {
	return request("/api/front/products", {
		keyword: data,
		page: 1,
		limit: 8
	})
}
// 热门搜索关键词
export const hotKeywords = () => {
	return request("/api/front/search/keyword")
}

// 热门推荐
export const hotRecommend = () => {
	return request("/api/front/product/hot", {
		page: 1,
		limit: 8
	})
}

// 新闻接口
// 新闻banner
export const newsBanner = () => {
	return request("/api/front/article/banner/list")
}

// 新闻热门
export const newsHot = () => {
	return request("/api/front/article/hot/list")
}

// 新闻内容
export const newsContent = () => {
	return request("/api/front/article/category/list")
}

// 获取新闻内容
export const newsC = (id) => {
	const url = "/api/front/article/list/" + id + "?page=1&limit=8"
	return request(url)
}

// 首页拼团
// 获取拼团列表
export const pintuanList = () => {
	return request("/api/front/combination/list", {
		page: 1,
		limit: 10
	})
}

// 获取拼团头部
export const pintuanHeader = () => {
	return request("/api/front/combination/header")
}

// 首页秒杀
// 秒杀头部
export const miaoshaHeader = () => {
	return request("/api/front/seckill/header")
}

// 首页砍价
// 砍价头部
export const kanHeader = () => {
	return request("/api/front/bargain/header")
}

// 首页收藏
// 收藏列表
export const shoucangList = () => {
	return request("/api/front/collect/user", {
		page: 1,
		limit: 8
	})
}

// 删除收藏
export const deleteCollection = (str) => {
	return request("/api/front/collect/delete", {
		ids: str
	}, "POST")
}
